package com.glsc.ngateway.flowable.listener.product;

import com.alibaba.fastjson.JSONObject;
import org.flowable.engine.delegate.TaskListener;
import org.flowable.task.service.delegate.DelegateTask;

import java.util.Arrays;

public class ProductStartHandler implements TaskListener {

    @Override
    public void notify(DelegateTask delegateTask) {

        String username = delegateTask.getVariable("userid").toString();
        String content = delegateTask.getVariable("content").toString();

        String[] v = {"lm1", "lm2"};
        delegateTask.setVariable("employee", "liuming");
        delegateTask.setVariable("bossList", Arrays.asList(v));
        delegateTask.setVariable("manager", "menglie");
        delegateTask.setVariable("officer", "yy");

        JSONObject json = JSONObject.parseObject(content);
        delegateTask.setVariable("money", json.getString("money"));

    }

}